﻿Imports MySql.Data.MySqlClient

Public Class frmTestGrid
    Dim Strsql As String
    Dim ClsMysql As New ClsSQLhelper
    Dim MyConnq As New MySql.Data.MySqlClient.MySqlConnection
    Dim DA As MySql.Data.MySqlClient.MySqlDataAdapter

    Dim MyCmdBuilder As MySql.Data.MySqlClient.MySqlCommandBuilder
    Dim MySQLCMD As MySql.Data.MySqlClient.MySqlCommand
    Dim DS As New DataSet
    Dim DT As New DataTable
    Dim DR As DataRow
    Private Sub frmTestGrid_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Strsql = "Select * from departments"
            Dim DT_Dep As New DataTable
            DT_Dep = ClsMysql.GetMYSQLDataTable(Strsql, "departments")

            With Me.CboDepartments
                .DataSource = DT_Dep
                .DisplayMember = "dep_name"
                .ValueMember = "dep_id"
            End With

            Strsql = "Select * from employee"
            'Dim DA As New MySql.Data.MySqlClient.MySqlDataAdapter(Strsql, MyConnq)
            DA = New MySql.Data.MySqlClient.MySqlDataAdapter(Strsql, MyConnq)
            MyConnq.ConnectionString = ClsSQLhelper.MySQLConnectionStr
            MyCmdBuilder = New MySqlCommandBuilder(DA)

            DS = New DataSet("employee")
            DA.Fill(DS)

            With GridControl1
                .DataSource = DS.Tables(0)
            End With
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

    Private Sub SimpleButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton1.Click
        DA.Update(DS.Tables(0))

    End Sub

    Private Sub GridControl1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GridControl1.Click

    End Sub
End Class